\(\int \frac {d+e x+f x^2+g x^3}{1+x^2+x^4} \, dx\) [17]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 127 \[ \int \frac {d+e x+f x^2+g x^3}{1+x^2+x^4} \, dx=-\frac {(d+f) \arctan \left (\frac {1-2 x}{\sqrt {3}}\right )}{2 \sqrt {3}}+\frac {(d+f) \arctan \left (\frac {1+2 x}{\sqrt {3}}\right )}{2 \sqrt {3}}+\frac {(2 e-g) \arctan \left (\frac {1+2 x^2}{\sqrt {3}}\right )}{2 \sqrt {3}}-\frac {1}{4} (d-f) \log \left (1-x+x^2\right )+\frac {1}{4} (d-f) \log \left (1+x+x^2\right )+\frac {1}{4} g \log \left (1+x^2+x^4\right ) \]

[Out]

-1/4*(d-f)*ln(x^2-x+1)+1/4*(d-f)*ln(x^2+x+1)+1/4*g*ln(x^4+x^2+1)-1/6*(d+f)*arctan(1/3*(1-2*x)*3^(1/2))*3^(1/2)
+1/6*(d+f)*arctan(1/3*(1+2*x)*3^(1/2))*3^(1/2)+1/6*(2*e-g)*arctan(1/3*(2*x^2+1)*3^(1/2))*3^(1/2)

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 127, normalized size of antiderivative = 1.00, number of steps used = 15, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.269, Rules used = {1687, 1183, 648, 632, 210, 642, 1261} \[ \int \frac {d+e x+f x^2+g x^3}{1+x^2+x^4} \, dx=-\frac {\arctan \left (\frac {1-2 x}{\sqrt {3}}\right ) (d+f)}{2 \sqrt {3}}+\frac {\arctan \left (\frac {2 x+1}{\sqrt {3}}\right ) (d+f)}{2 \sqrt {3}}+\frac {\arctan \left (\frac {2 x^2+1}{\sqrt {3}}\right ) (2 e-g)}{2 \sqrt {3}}-\frac {1}{4} (d-f) \log \left (x^2-x+1\right )+\frac {1}{4} (d-f) \log \left (x^2+x+1\right )+\frac {1}{4} g \log \left (x^4+x^2+1\right ) \]

[In]

Int[(d + e*x + f*x^2 + g*x^3)/(1 + x^2 + x^4),x]

[Out]

-1/2*((d + f)*ArcTan[(1 - 2*x)/Sqrt[3]])/Sqrt[3] + ((d + f)*ArcTan[(1 + 2*x)/Sqrt[3]])/(2*Sqrt[3]) + ((2*e - g
)*ArcTan[(1 + 2*x^2)/Sqrt[3]])/(2*Sqrt[3]) - ((d - f)*Log[1 - x + x^2])/4 + ((d - f)*Log[1 + x + x^2])/4 + (g*
Log[1 + x^2 + x^4])/4

Rule 210

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^(-1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])
], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 642

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[d*(Log[RemoveContent[a + b*x +
c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 648

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 1183

Int[((d_) + (e_.)*(x_)^2)/((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4), x_Symbol] :> With[{q = Rt[a/c, 2]}, With[{r =
Rt[2*q - b/c, 2]}, Dist[1/(2*c*q*r), Int[(d*r - (d - e*q)*x)/(q - r*x + x^2), x], x] + Dist[1/(2*c*q*r), Int[(
d*r + (d - e*q)*x)/(q + r*x + x^2), x], x]]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2
- b*d*e + a*e^2, 0] && NegQ[b^2 - 4*a*c]

Rule 1261

Int[(x_)*((d_) + (e_.)*(x_)^2)^(q_.)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_.), x_Symbol] :> Dist[1/2, Subst[
Int[(d + e*x)^q*(a + b*x + c*x^2)^p, x], x, x^2], x] /; FreeQ[{a, b, c, d, e, p, q}, x]

Rule 1687

Int[(Pq_)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_), x_Symbol] :> Module[{q = Expon[Pq, x], k}, Int[Sum[Coeff[
Pq, x, 2*k]*x^(2*k), {k, 0, q/2}]*(a + b*x^2 + c*x^4)^p, x] + Int[x*Sum[Coeff[Pq, x, 2*k + 1]*x^(2*k), {k, 0,
(q - 1)/2}]*(a + b*x^2 + c*x^4)^p, x]] /; FreeQ[{a, b, c, p}, x] && PolyQ[Pq, x] &&  !PolyQ[Pq, x^2]

Rubi steps \begin{align*} \text {integral}& = \int \frac {d+f x^2}{1+x^2+x^4} \, dx+\int \frac {x \left (e+g x^2\right )}{1+x^2+x^4} \, dx \\ & = \frac {1}{2} \int \frac {d-(d-f) x}{1-x+x^2} \, dx+\frac {1}{2} \int \frac {d+(d-f) x}{1+x+x^2} \, dx+\frac {1}{2} \text {Subst}\left (\int \frac {e+g x}{1+x+x^2} \, dx,x,x^2\right ) \\ & = \frac {1}{4} (d-f) \int \frac {1+2 x}{1+x+x^2} \, dx+\frac {1}{4} (-d+f) \int \frac {-1+2 x}{1-x+x^2} \, dx+\frac {1}{4} (d+f) \int \frac {1}{1-x+x^2} \, dx+\frac {1}{4} (d+f) \int \frac {1}{1+x+x^2} \, dx+\frac {1}{4} (2 e-g) \text {Subst}\left (\int \frac {1}{1+x+x^2} \, dx,x,x^2\right )+\frac {1}{4} g \text {Subst}\left (\int \frac {1+2 x}{1+x+x^2} \, dx,x,x^2\right ) \\ & = -\frac {1}{4} (d-f) \log \left (1-x+x^2\right )+\frac {1}{4} (d-f) \log \left (1+x+x^2\right )+\frac {1}{4} g \log \left (1+x^2+x^4\right )+\frac {1}{2} (-d-f) \text {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,-1+2 x\right )+\frac {1}{2} (-d-f) \text {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,1+2 x\right )+\frac {1}{2} (-2 e+g) \text {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,1+2 x^2\right ) \\ & = -\frac {(d+f) \tan ^{-1}\left (\frac {1-2 x}{\sqrt {3}}\right )}{2 \sqrt {3}}+\frac {(d+f) \tan ^{-1}\left (\frac {1+2 x}{\sqrt {3}}\right )}{2 \sqrt {3}}+\frac {(2 e-g) \tan ^{-1}\left (\frac {1+2 x^2}{\sqrt {3}}\right )}{2 \sqrt {3}}-\frac {1}{4} (d-f) \log \left (1-x+x^2\right )+\frac {1}{4} (d-f) \log \left (1+x+x^2\right )+\frac {1}{4} g \log \left (1+x^2+x^4\right ) \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.36 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.18 \[ \int \frac {d+e x+f x^2+g x^3}{1+x^2+x^4} \, dx=\frac {2 \sqrt {2-2 i \sqrt {3}} \left (2 i d+\left (-i+\sqrt {3}\right ) f\right ) \arctan \left (\frac {1}{2} \left (-i+\sqrt {3}\right ) x\right )+2 \left (\sqrt {2+2 i \sqrt {3}} \left (-2 i d+\left (i+\sqrt {3}\right ) f\right ) \arctan \left (\frac {1}{2} \left (i+\sqrt {3}\right ) x\right )+(-4 e+2 g) \arctan \left (\frac {\sqrt {3}}{1+2 x^2}\right )+\sqrt {3} g \log \left (1+x^2+x^4\right )\right )}{8 \sqrt {3}} \]

[In]

Integrate[(d + e*x + f*x^2 + g*x^3)/(1 + x^2 + x^4),x]

[Out]

(2*Sqrt[2 - (2*I)*Sqrt[3]]*((2*I)*d + (-I + Sqrt[3])*f)*ArcTan[((-I + Sqrt[3])*x)/2] + 2*(Sqrt[2 + (2*I)*Sqrt[
3]]*((-2*I)*d + (I + Sqrt[3])*f)*ArcTan[((I + Sqrt[3])*x)/2] + (-4*e + 2*g)*ArcTan[Sqrt[3]/(1 + 2*x^2)] + Sqrt
[3]*g*Log[1 + x^2 + x^4]))/(8*Sqrt[3])

Maple [A] (verified)

Time = 0.27 (sec) , antiderivative size = 90, normalized size of antiderivative = 0.71

method result size
default \(\frac {\left (f -d +g \right ) \ln \left (x^{2}-x +1\right )}{4}+\frac {\left (\frac {d}{2}+e +\frac {f}{2}-\frac {g}{2}\right ) \sqrt {3}\, \arctan \left (\frac {\left (2 x -1\right ) \sqrt {3}}{3}\right )}{3}+\frac {\left (d -f +g \right ) \ln \left (x^{2}+x +1\right )}{4}+\frac {\left (\frac {d}{2}-e +\frac {f}{2}+\frac {g}{2}\right ) \arctan \left (\frac {\left (1+2 x \right ) \sqrt {3}}{3}\right ) \sqrt {3}}{3}\) \(90\)
risch \(\text {Expression too large to display}\) \(27628\)

[In]

int((g*x^3+f*x^2+e*x+d)/(x^4+x^2+1),x,method=_RETURNVERBOSE)

[Out]

1/4*(f-d+g)*ln(x^2-x+1)+1/3*(1/2*d+e+1/2*f-1/2*g)*3^(1/2)*arctan(1/3*(2*x-1)*3^(1/2))+1/4*(d-f+g)*ln(x^2+x+1)+
1/3*(1/2*d-e+1/2*f+1/2*g)*arctan(1/3*(1+2*x)*3^(1/2))*3^(1/2)

Fricas [A] (verification not implemented)

none

Time = 0.41 (sec) , antiderivative size = 83, normalized size of antiderivative = 0.65 \[ \int \frac {d+e x+f x^2+g x^3}{1+x^2+x^4} \, dx=\frac {1}{6} \, \sqrt {3} {\left (d - 2 \, e + f + g\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) + \frac {1}{6} \, \sqrt {3} {\left (d + 2 \, e + f - g\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) + \frac {1}{4} \, {\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac {1}{4} \, {\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \]

[In]

integrate((g*x^3+f*x^2+e*x+d)/(x^4+x^2+1),x, algorithm="fricas")

[Out]

1/6*sqrt(3)*(d - 2*e + f + g)*arctan(1/3*sqrt(3)*(2*x + 1)) + 1/6*sqrt(3)*(d + 2*e + f - g)*arctan(1/3*sqrt(3)
*(2*x - 1)) + 1/4*(d - f + g)*log(x^2 + x + 1) - 1/4*(d - f - g)*log(x^2 - x + 1)

Sympy [F(-1)]

Timed out. \[ \int \frac {d+e x+f x^2+g x^3}{1+x^2+x^4} \, dx=\text {Timed out} \]

[In]

integrate((g*x**3+f*x**2+e*x+d)/(x**4+x**2+1),x)

[Out]

Timed out

Maxima [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 83, normalized size of antiderivative = 0.65 \[ \int \frac {d+e x+f x^2+g x^3}{1+x^2+x^4} \, dx=\frac {1}{6} \, \sqrt {3} {\left (d - 2 \, e + f + g\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) + \frac {1}{6} \, \sqrt {3} {\left (d + 2 \, e + f - g\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) + \frac {1}{4} \, {\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac {1}{4} \, {\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \]

[In]

integrate((g*x^3+f*x^2+e*x+d)/(x^4+x^2+1),x, algorithm="maxima")

[Out]

1/6*sqrt(3)*(d - 2*e + f + g)*arctan(1/3*sqrt(3)*(2*x + 1)) + 1/6*sqrt(3)*(d + 2*e + f - g)*arctan(1/3*sqrt(3)
*(2*x - 1)) + 1/4*(d - f + g)*log(x^2 + x + 1) - 1/4*(d - f - g)*log(x^2 - x + 1)

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 83, normalized size of antiderivative = 0.65 \[ \int \frac {d+e x+f x^2+g x^3}{1+x^2+x^4} \, dx=\frac {1}{6} \, \sqrt {3} {\left (d - 2 \, e + f + g\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) + \frac {1}{6} \, \sqrt {3} {\left (d + 2 \, e + f - g\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) + \frac {1}{4} \, {\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac {1}{4} \, {\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \]

[In]

integrate((g*x^3+f*x^2+e*x+d)/(x^4+x^2+1),x, algorithm="giac")

[Out]

1/6*sqrt(3)*(d - 2*e + f + g)*arctan(1/3*sqrt(3)*(2*x + 1)) + 1/6*sqrt(3)*(d + 2*e + f - g)*arctan(1/3*sqrt(3)
*(2*x - 1)) + 1/4*(d - f + g)*log(x^2 + x + 1) - 1/4*(d - f - g)*log(x^2 - x + 1)

Mupad [B] (verification not implemented)

Time = 8.11 (sec) , antiderivative size = 199, normalized size of antiderivative = 1.57 \[ \int \frac {d+e x+f x^2+g x^3}{1+x^2+x^4} \, dx=-\ln \left (x-\frac {1}{2}-\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {d}{4}-\frac {f}{4}-\frac {g}{4}+\frac {\sqrt {3}\,d\,1{}\mathrm {i}}{12}+\frac {\sqrt {3}\,e\,1{}\mathrm {i}}{6}+\frac {\sqrt {3}\,f\,1{}\mathrm {i}}{12}-\frac {\sqrt {3}\,g\,1{}\mathrm {i}}{12}\right )-\ln \left (x+\frac {1}{2}-\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {f}{4}-\frac {d}{4}-\frac {g}{4}+\frac {\sqrt {3}\,d\,1{}\mathrm {i}}{12}-\frac {\sqrt {3}\,e\,1{}\mathrm {i}}{6}+\frac {\sqrt {3}\,f\,1{}\mathrm {i}}{12}+\frac {\sqrt {3}\,g\,1{}\mathrm {i}}{12}\right )+\ln \left (x-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {f}{4}-\frac {d}{4}+\frac {g}{4}+\frac {\sqrt {3}\,d\,1{}\mathrm {i}}{12}+\frac {\sqrt {3}\,e\,1{}\mathrm {i}}{6}+\frac {\sqrt {3}\,f\,1{}\mathrm {i}}{12}-\frac {\sqrt {3}\,g\,1{}\mathrm {i}}{12}\right )+\ln \left (x+\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {d}{4}-\frac {f}{4}+\frac {g}{4}+\frac {\sqrt {3}\,d\,1{}\mathrm {i}}{12}-\frac {\sqrt {3}\,e\,1{}\mathrm {i}}{6}+\frac {\sqrt {3}\,f\,1{}\mathrm {i}}{12}+\frac {\sqrt {3}\,g\,1{}\mathrm {i}}{12}\right ) \]

[In]

int((d + e*x + f*x^2 + g*x^3)/(x^2 + x^4 + 1),x)

[Out]

log(x + (3^(1/2)*1i)/2 - 1/2)*(f/4 - d/4 + g/4 + (3^(1/2)*d*1i)/12 + (3^(1/2)*e*1i)/6 + (3^(1/2)*f*1i)/12 - (3
^(1/2)*g*1i)/12) - log(x - (3^(1/2)*1i)/2 + 1/2)*(f/4 - d/4 - g/4 + (3^(1/2)*d*1i)/12 - (3^(1/2)*e*1i)/6 + (3^
(1/2)*f*1i)/12 + (3^(1/2)*g*1i)/12) - log(x - (3^(1/2)*1i)/2 - 1/2)*(d/4 - f/4 - g/4 + (3^(1/2)*d*1i)/12 + (3^
(1/2)*e*1i)/6 + (3^(1/2)*f*1i)/12 - (3^(1/2)*g*1i)/12) + log(x + (3^(1/2)*1i)/2 + 1/2)*(d/4 - f/4 + g/4 + (3^(
1/2)*d*1i)/12 - (3^(1/2)*e*1i)/6 + (3^(1/2)*f*1i)/12 + (3^(1/2)*g*1i)/12)